home *** CD-ROM | disk | FTP | other *** search
/ Champak 86 / (Vol 86) My Disc.iso / Games / pet_1112.swf / scripts / __Packages / caurina / transitions / SpecialPropertiesDefault.as < prev    next >
Text File  |  2009-04-14  |  12KB  |  283 lines

  1. class caurina.transitions.SpecialPropertiesDefault
  2. {
  3.    function SpecialPropertiesDefault()
  4.    {
  5.       trace("SpecialProperties is an static class and should not be instantiated.");
  6.    }
  7.    static function init()
  8.    {
  9.       caurina.transitions.Tweener.registerSpecialProperty("_frame",caurina.transitions.SpecialPropertiesDefault._frame_get,caurina.transitions.SpecialPropertiesDefault._frame_set);
  10.       caurina.transitions.Tweener.registerSpecialProperty("_sound_volume",caurina.transitions.SpecialPropertiesDefault._sound_volume_get,caurina.transitions.SpecialPropertiesDefault._sound_volume_set);
  11.       caurina.transitions.Tweener.registerSpecialProperty("_sound_pan",caurina.transitions.SpecialPropertiesDefault._sound_pan_get,caurina.transitions.SpecialPropertiesDefault._sound_pan_set);
  12.       caurina.transitions.Tweener.registerSpecialProperty("_color_ra",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["ra"]);
  13.       caurina.transitions.Tweener.registerSpecialProperty("_color_rb",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["rb"]);
  14.       caurina.transitions.Tweener.registerSpecialProperty("_color_ga",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["ga"]);
  15.       caurina.transitions.Tweener.registerSpecialProperty("_color_gb",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["gb"]);
  16.       caurina.transitions.Tweener.registerSpecialProperty("_color_ba",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["ba"]);
  17.       caurina.transitions.Tweener.registerSpecialProperty("_color_bb",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["bb"]);
  18.       caurina.transitions.Tweener.registerSpecialProperty("_color_aa",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["aa"]);
  19.       caurina.transitions.Tweener.registerSpecialProperty("_color_ab",caurina.transitions.SpecialPropertiesDefault._color_property_get,caurina.transitions.SpecialPropertiesDefault._color_property_set,["ab"]);
  20.       caurina.transitions.Tweener.registerSpecialProperty("_autoAlpha",caurina.transitions.SpecialPropertiesDefault._autoAlpha_get,caurina.transitions.SpecialPropertiesDefault._autoAlpha_set);
  21.       caurina.transitions.Tweener.registerSpecialPropertySplitter("_color",caurina.transitions.SpecialPropertiesDefault._color_splitter);
  22.       caurina.transitions.Tweener.registerSpecialPropertySplitter("_colorTransform",caurina.transitions.SpecialPropertiesDefault._colorTransform_splitter);
  23.       caurina.transitions.Tweener.registerSpecialPropertySplitter("_scale",caurina.transitions.SpecialPropertiesDefault._scale_splitter);
  24.       caurina.transitions.Tweener.registerSpecialProperty("_blur_blurX",caurina.transitions.SpecialPropertiesDefault._filter_property_get,caurina.transitions.SpecialPropertiesDefault._filter_property_set,[flash.filters.BlurFilter,"blurX"]);
  25.       caurina.transitions.Tweener.registerSpecialProperty("_blur_blurY",caurina.transitions.SpecialPropertiesDefault._filter_property_get,caurina.transitions.SpecialPropertiesDefault._filter_property_set,[flash.filters.BlurFilter,"blurY"]);
  26.       caurina.transitions.Tweener.registerSpecialProperty("_blur_quality",caurina.transitions.SpecialPropertiesDefault._filter_property_get,caurina.transitions.SpecialPropertiesDefault._filter_property_set,[flash.filters.BlurFilter,"quality"]);
  27.       caurina.transitions.Tweener.registerSpecialPropertySplitter("_filter",caurina.transitions.SpecialPropertiesDefault._filter_splitter);
  28.       caurina.transitions.Tweener.registerSpecialPropertyModifier("_bezier",caurina.transitions.SpecialPropertiesDefault._bezier_modifier,caurina.transitions.SpecialPropertiesDefault._bezier_get);
  29.    }
  30.    static function _color_splitter(p_value)
  31.    {
  32.       var _loc1_ = new Array();
  33.       if(p_value == null)
  34.       {
  35.          _loc1_.push({name:"_color_ra",value:100});
  36.          _loc1_.push({name:"_color_rb",value:0});
  37.          _loc1_.push({name:"_color_ga",value:100});
  38.          _loc1_.push({name:"_color_gb",value:0});
  39.          _loc1_.push({name:"_color_ba",value:100});
  40.          _loc1_.push({name:"_color_bb",value:0});
  41.       }
  42.       else
  43.       {
  44.          _loc1_.push({name:"_color_ra",value:0});
  45.          _loc1_.push({name:"_color_rb",value:caurina.transitions.AuxFunctions.numberToR(p_value)});
  46.          _loc1_.push({name:"_color_ga",value:0});
  47.          _loc1_.push({name:"_color_gb",value:caurina.transitions.AuxFunctions.numberToG(p_value)});
  48.          _loc1_.push({name:"_color_ba",value:0});
  49.          _loc1_.push({name:"_color_bb",value:caurina.transitions.AuxFunctions.numberToB(p_value)});
  50.       }
  51.       return _loc1_;
  52.    }
  53.    static function _colorTransform_splitter(p_value)
  54.    {
  55.       var _loc2_ = new Array();
  56.       if(p_value == null)
  57.       {
  58.          _loc2_.push({name:"_color_ra",value:100});
  59.          _loc2_.push({name:"_color_rb",value:0});
  60.          _loc2_.push({name:"_color_ga",value:100});
  61.          _loc2_.push({name:"_color_gb",value:0});
  62.          _loc2_.push({name:"_color_ba",value:100});
  63.          _loc2_.push({name:"_color_bb",value:0});
  64.       }
  65.       else
  66.       {
  67.          if(p_value.ra != undefined)
  68.          {
  69.             _loc2_.push({name:"_color_ra",value:p_value.ra});
  70.          }
  71.          if(p_value.rb != undefined)
  72.          {
  73.             _loc2_.push({name:"_color_rb",value:p_value.rb});
  74.          }
  75.          if(p_value.ga != undefined)
  76.          {
  77.             _loc2_.push({name:"_color_ba",value:p_value.ba});
  78.          }
  79.          if(p_value.gb != undefined)
  80.          {
  81.             _loc2_.push({name:"_color_bb",value:p_value.bb});
  82.          }
  83.          if(p_value.ba != undefined)
  84.          {
  85.             _loc2_.push({name:"_color_ga",value:p_value.ga});
  86.          }
  87.          if(p_value.bb != undefined)
  88.          {
  89.             _loc2_.push({name:"_color_gb",value:p_value.gb});
  90.          }
  91.          if(p_value.aa != undefined)
  92.          {
  93.             _loc2_.push({name:"_color_aa",value:p_value.aa});
  94.          }
  95.          if(p_value.ab != undefined)
  96.          {
  97.             _loc2_.push({name:"_color_ab",value:p_value.ab});
  98.          }
  99.       }
  100.       return _loc2_;
  101.    }
  102.    static function _scale_splitter(p_value)
  103.    {
  104.       var _loc1_ = new Array();
  105.       _loc1_.push({name:"_xscale",value:p_value});
  106.       _loc1_.push({name:"_yscale",value:p_value});
  107.       return _loc1_;
  108.    }
  109.    static function _filter_splitter(p_value)
  110.    {
  111.       var _loc1_ = new Array();
  112.       if(p_value instanceof flash.filters.BlurFilter)
  113.       {
  114.          _loc1_.push({name:"_blur_blurX",value:flash.filters.BlurFilter(p_value).blurX});
  115.          _loc1_.push({name:"_blur_blurY",value:flash.filters.BlurFilter(p_value).blurY});
  116.          _loc1_.push({name:"_blur_quality",value:flash.filters.BlurFilter(p_value).quality});
  117.       }
  118.       else
  119.       {
  120.          trace("??");
  121.       }
  122.       return _loc1_;
  123.    }
  124.    static function _frame_get(p_obj)
  125.    {
  126.       return p_obj._currentFrame;
  127.    }
  128.    static function _frame_set(p_obj, p_value)
  129.    {
  130.       p_obj.gotoAndStop(Math.round(p_value));
  131.    }
  132.    static function _sound_volume_get(p_obj)
  133.    {
  134.       return p_obj.getVolume();
  135.    }
  136.    static function _sound_volume_set(p_obj, p_value)
  137.    {
  138.       p_obj.setVolume(p_value);
  139.    }
  140.    static function _sound_pan_get(p_obj)
  141.    {
  142.       return p_obj.getPan();
  143.    }
  144.    static function _sound_pan_set(p_obj, p_value)
  145.    {
  146.       p_obj.setPan(p_value);
  147.    }
  148.    static function _color_property_get(p_obj, p_parameters)
  149.    {
  150.       return new Color(p_obj).getTransform()[p_parameters[0]];
  151.    }
  152.    static function _color_property_set(p_obj, p_value, p_parameters)
  153.    {
  154.       var _loc1_ = new Object();
  155.       _loc1_[p_parameters[0]] = Math.round(p_value);
  156.       new Color(p_obj).setTransform(_loc1_);
  157.    }
  158.    static function _autoAlpha_get(p_obj)
  159.    {
  160.       return p_obj._alpha;
  161.    }
  162.    static function _autoAlpha_set(p_obj, p_value)
  163.    {
  164.       p_obj._alpha = p_value;
  165.       p_obj._visible = p_value > 0;
  166.    }
  167.    static function _filter_property_get(p_obj, p_parameters)
  168.    {
  169.       var _loc2_ = p_obj.filters;
  170.       var _loc1_ = undefined;
  171.       var _loc4_ = p_parameters[0];
  172.       var _loc3_ = p_parameters[1];
  173.       _loc1_ = 0;
  174.       while(_loc1_ < _loc2_.length)
  175.       {
  176.          if(_loc2_[_loc1_] instanceof _loc4_)
  177.          {
  178.             return _loc2_[_loc1_][_loc3_];
  179.          }
  180.          _loc1_ = _loc1_ + 1;
  181.       }
  182.       var _loc5_ = undefined;
  183.       var _loc0_ = null;
  184.       if((_loc0_ = _loc4_) === flash.filters.BlurFilter)
  185.       {
  186.          _loc5_ = {blurX:0,blurY:0,quality:NaN};
  187.       }
  188.       return _loc5_[_loc3_];
  189.    }
  190.    static function _filter_property_set(p_obj, p_value, p_parameters)
  191.    {
  192.       var _loc2_ = p_obj.filters;
  193.       var _loc1_ = undefined;
  194.       var _loc4_ = p_parameters[0];
  195.       var _loc3_ = p_parameters[1];
  196.       _loc1_ = 0;
  197.       while(_loc1_ < _loc2_.length)
  198.       {
  199.          if(_loc2_[_loc1_] instanceof _loc4_)
  200.          {
  201.             _loc2_[_loc1_][_loc3_] = p_value;
  202.             p_obj.filters = _loc2_;
  203.             return undefined;
  204.          }
  205.          _loc1_ = _loc1_ + 1;
  206.       }
  207.       if(_loc2_ == undefined)
  208.       {
  209.          _loc2_ = new Array();
  210.       }
  211.       var _loc7_ = undefined;
  212.       var _loc0_ = null;
  213.       if((_loc0_ = _loc4_) === flash.filters.BlurFilter)
  214.       {
  215.          _loc7_ = new flash.filters.BlurFilter(0,0);
  216.       }
  217.       _loc7_[_loc3_] = p_value;
  218.       _loc2_.push(_loc7_);
  219.       p_obj.filters = _loc2_;
  220.    }
  221.    static function _bezier_modifier(p_obj)
  222.    {
  223.       var _loc7_ = [];
  224.       var _loc4_ = undefined;
  225.       if(p_obj instanceof Array)
  226.       {
  227.          _loc4_ = p_obj;
  228.       }
  229.       else
  230.       {
  231.          _loc4_ = [p_obj];
  232.       }
  233.       var _loc3_ = undefined;
  234.       var _loc1_ = undefined;
  235.       var _loc2_ = {};
  236.       _loc3_ = 0;
  237.       while(_loc3_ < _loc4_.length)
  238.       {
  239.          for(_loc1_ in _loc4_[_loc3_])
  240.          {
  241.             if(_loc2_[_loc1_] == undefined)
  242.             {
  243.                _loc2_[_loc1_] = [];
  244.             }
  245.             _loc2_[_loc1_].push(_loc4_[_loc3_][_loc1_]);
  246.          }
  247.          _loc3_ = _loc3_ + 1;
  248.       }
  249.       for(_loc1_ in _loc2_)
  250.       {
  251.          _loc7_.push({name:_loc1_,parameters:_loc2_[_loc1_]});
  252.       }
  253.       return _loc7_;
  254.    }
  255.    static function _bezier_get(b, e, t, p)
  256.    {
  257.       if(p.length == 1)
  258.       {
  259.          return b + t * (2 * (1 - t) * (p[0] - b) + t * (e - b));
  260.       }
  261.       var _loc2_ = Math.floor(t * p.length);
  262.       var _loc5_ = (t - _loc2_ * (1 / p.length)) * p.length;
  263.       var _loc3_ = undefined;
  264.       var _loc6_ = undefined;
  265.       if(_loc2_ == 0)
  266.       {
  267.          _loc3_ = b;
  268.          _loc6_ = (p[0] + p[1]) / 2;
  269.       }
  270.       else if(_loc2_ == p.length - 1)
  271.       {
  272.          _loc3_ = (p[_loc2_ - 1] + p[_loc2_]) / 2;
  273.          _loc6_ = e;
  274.       }
  275.       else
  276.       {
  277.          _loc3_ = (p[_loc2_ - 1] + p[_loc2_]) / 2;
  278.          _loc6_ = (p[_loc2_] + p[_loc2_ + 1]) / 2;
  279.       }
  280.       return _loc3_ + _loc5_ * (2 * (1 - _loc5_) * (p[_loc2_] - _loc3_) + _loc5_ * (_loc6_ - _loc3_));
  281.    }
  282. }
  283.